/*
 * @Author: malei
 * @Date: 2021-06-16 16:54:35
 * @LastEditors: malei
 * @LastEditTime: 2021-06-16 19:07:18
 */
#pragma once
#include "video_capture.h"
#include "modules/video_capture/video_capture_defines.h"
using namespace webrtc;
class ExternalVideoCapturerModule;
class ExternalVideoCapturer : public VideoCapturer,
                              public rtc::VideoSinkInterface<webrtc::VideoFrame>
{

public:

    static std::unique_ptr<ExternalVideoCapturer> Create();

    virtual ~ExternalVideoCapturer();

    void OnExternalVideoCaptured(const uint8_t *data, unsigned int len, int width, int height, int64_t ntpTimestamp);

    bool Initialize();

    void OnFrame(const webrtc::VideoFrame &frame) override;


    ExternalVideoCapturer();
protected:
    void Destroy();

    int format;

    rtc::scoped_refptr<ExternalVideoCapturerModule> extc_;
    webrtc::VideoCaptureCapability capability_;
};
